/**
 * 
 * Copyright (C) 2015 by Elcom Software Company
 *
 * @id: GraphAPIBase.java, May 8, 2015
 *
 */
package com.nip.fblike.grapapi;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * @author ThangNM<thangnm@elcom.com.vn>
 *
 * @version v
 */
public abstract class GraphAPIBase implements IParserJson{

    private String uid;
    private String access_token;
    protected final IFBLike iFBLike;
    
    /**
     * @param iFBLike
     */
    public GraphAPIBase(IFBLike iFBLike) {
        super();
        this.iFBLike = iFBLike;
        // TODO Auto-generated constructor stub
        setAccess_token("763795493643601|D9WXwFYWK3kZ5WftrpmVbm1GG48");
    }
    /**
     * @return the uid
     */
    public String getUid() {
        return uid;
    }
    /**
     * @param uid the uid to set
     */
    public void setUid(String uid) {
        this.uid = uid;
    }
    /**
     * @return the access_token
     */
    public String getAccess_token() {
        return access_token;
    }
    /**
     * @param access_token the access_token to set
     */
    public void setAccess_token(String access_token) {
        this.access_token = access_token;
    }
    
    public abstract String getUrl();
    
    /**
     * @param jsonObject
     * @param string
     * @return
     */
    protected String safeReadString(JSONObject jsonObject, String key) {
        // TODO Auto-generated method stub
        String value = "";
        try
        {
            value = jsonObject.getString(key);
        }catch(JSONException e)
        {
            
        }
        return value;
    }
}
